package com.xywy.tangandroid.util;

import android.app.Activity;
import android.content.Context;
import android.content.SharedPreferences;

public class SaveLoginPreference {

	// 保存用户登录信息
	public static void saveParam(Context con, String username, String password) {
		SharedPreferences sp = con.getSharedPreferences("login.pre",
				Activity.MODE_PRIVATE);
		sp.edit().putString("username", username)
				.putString("password", password).commit();
	}

	// 获取用户登录信息
	public static String[] getParam(Context con) {
		SharedPreferences sp = con.getSharedPreferences("login.pre",
				Activity.MODE_PRIVATE);
		String param[] = new String[2];
		param[0] = sp.getString("username", null);
		param[1] = sp.getString("password", null);
		return param;
	}
}
